﻿<navigation:Page x:Class="SinaDesktop.Home" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    xmlns:controls="clr-namespace:SilverlightChina.Controls;assembly=SilverlightChina.Controls"
    xmlns:tooltipcontrol="clr-namespace:Silverlight.Controls.ToolTips;assembly=Silverlight.Controls.ToolTips"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    xmlns:converters="clr-namespace:SinaDesktop.Converters"
    d:DesignWidth="640" d:DesignHeight="300" mc:Ignorable="d" SizeChanged="Page_SizeChanged"  
    Style="{StaticResource PageStyle}" Title="新浪微博">

    <navigation:Page.Resources>
        <converters:TextCountConverter x:Key="TextCountConverter" />
        <converters:TextCountVisibilityConverter x:Key="TextCountVisibilityConverter" />

        <Storyboard x:Name="hideMenu">
            <DoubleAnimation Storyboard.TargetName="BrandingBorder" Storyboard.TargetProperty="Height" To="0" Duration="0:0:0.3"></DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="BrandingStackPanel" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.2"></DoubleAnimation>
        </Storyboard>
        <Storyboard x:Name="showMenu">
            <DoubleAnimation Storyboard.TargetName="BrandingBorder" Storyboard.TargetProperty="Height" To="70" Duration="0:0:0.3"></DoubleAnimation>
            <DoubleAnimation Storyboard.TargetName="BrandingStackPanel" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.2"></DoubleAnimation>
        </Storyboard>
    </navigation:Page.Resources>

    <Grid x:Name="LayoutRoot" Style="{StaticResource LayoutRootGridStyle}">
        
        <toolkit:DockPanel LastChildFill="True" >
            <!--<Border x:Name="BackgroundBorder" Style="{StaticResource ContentBorderStyle}" Grid.RowSpan="2" />-->

            <Grid x:Name="spMenu" toolkit:DockPanel.Dock="Left" >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                <StackPanel x:Name="LinksStackPanel" VerticalAlignment="Top" HorizontalAlignment="Center">
                    <HyperlinkButton x:Name="hbUserPhoto" Click="hbUserPhoto_Click" Margin="10" VerticalAlignment="Center" HorizontalAlignment="Center"  Width="52" Height="52">
                        <Border BorderThickness="1" BorderBrush="LightGray" VerticalAlignment="Center" HorizontalAlignment="Center" Width="52" Height="52" >
                            <Image x:Name="imgOwner" Source="{Binding CustomizeImageURL, Converter={StaticResource StringConverter}}" Width="50">
                                <tooltipcontrol:ToolTipService.ToolTip>
                                    <tooltipcontrol:ToolTip x:Name="tooltipControl" 
                                                        Style="{StaticResource ToolTipStyle}" DisplayTime="00:00:15" InitialDelay="00:00:00">

                                        <tooltipcontrol:ToolTip.CloseAnimation>
                                            <Storyboard Duration="00:00:01">
                                                <DoubleAnimation From="1"
                                                         To="0"
                                                         Storyboard.TargetName="tooltipControl"
                                                         Storyboard.TargetProperty="Opacity" />
                                            </Storyboard>
                                        </tooltipcontrol:ToolTip.CloseAnimation>

                                        <tooltipcontrol:ToolTip.OpenAnimation>
                                            <Storyboard Duration="00:00:01">
                                                <DoubleAnimation From="0"
                                                         To="1"
                                                         Storyboard.TargetName="tooltipControl"
                                                         Storyboard.TargetProperty="Opacity" />
                                            </Storyboard>
                                        </tooltipcontrol:ToolTip.OpenAnimation>

                                        <tooltipcontrol:ToolTip.Content>
                                            <Grid Margin="2">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="60" />
                                                    <ColumnDefinition Width="*" />
                                                </Grid.ColumnDefinitions>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="Auto" />
                                                    <RowDefinition Height="*" />
                                                </Grid.RowDefinitions>

                                                <Border BorderThickness="1" Grid.RowSpan="2" VerticalAlignment="Top" BorderBrush="DarkGray" Margin="2" Width="54" Height="54">
                                                    <Image x:Name="imgFriendPic" Width="52" VerticalAlignment="Top" Margin="2" Source="{Binding CustomizeImageURL, Converter={StaticResource StringConverter}}"/>
                                                </Border>

                                                <StackPanel Orientation="Vertical" Grid.Column="1" Margin="2">
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBlock x:Name="tbFriendName"  Margin="1" Text="{Binding FriendName}" FontWeight="Bold"/>
                                                        <Image Source="/SinaDesktop;component/Images/verify.png" Width="14" Margin="0,-6,0,0" Visibility="{Binding IsVerified, Converter={StaticResource VisibilityConverter}}"></Image>
                                                    </StackPanel>
                                                    
                                                    <TextBlock x:Name="tbLocation" Text="{Binding Location}" Margin="1" Foreground="Gray"/>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBlock Text="关注" Margin="1,0,0,0" Foreground="Gray"/>
                                                        <TextBlock Text="{Binding FriendCount}" Margin="1,0,0,0" Foreground="#FF58C3FD"/>
                                                        <TextBlock Text="粉丝" Foreground="Gray" Margin="6,0,0,0"/>
                                                        <TextBlock Text="{Binding FollowerCount}" Margin="1,0,0,0" Foreground="#FF58C3FD" />
                                                        <TextBlock Text="微博" Foreground="Gray" Margin="6,0,0,0"/>
                                                        <TextBlock Text="{Binding StatusesCount}" Margin="1,0,0,0" Foreground="#FF58C3FD"/>
                                                    </StackPanel>
                                                </StackPanel>

                                                <TextBlock Text="简介:" HorizontalAlignment="Center" Grid.Row="1" Grid.Column="0" Visibility="{Binding Path=Text.Length, ElementName=tbDescription, Converter={StaticResource TextCountVisibilityConverter}}"/>
                                                <TextBlock x:Name="tbDescription" Text="{Binding Description}" TextWrapping="Wrap" Width="300" Grid.Row="1" Grid.Column="1"/>
                                            </Grid>
                                        </tooltipcontrol:ToolTip.Content>

                                    </tooltipcontrol:ToolTip>
                                </tooltipcontrol:ToolTipService.ToolTip>
                            </Image>
                        </Border>
                    </HyperlinkButton>
                    
                    <HyperlinkButton x:Name="hbFriendline" ToolTipService.ToolTip="最新" Style="{StaticResource MenuLinkStyle}" Click="hbFriendline_Click" >
                        <Image Source="/SinaDesktop;component/Images/home.png" Width="32" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </HyperlinkButton>

                    <Grid>
                        <HyperlinkButton x:Name="hbAtme" ToolTipService.ToolTip="點名" Style="{StaticResource MenuLinkStyle}" Click="hbAtme_Click">
                            <Image Source="/SinaDesktop;component/Images/atme.png" Width="32" HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </HyperlinkButton>
                        <Button x:Name="btMentionCount" Style="{StaticResource CustomizeButtonStyle}" Width="16" Height="16" Foreground="White" Margin="40,10,0,0" FontSize="10" Visibility="Collapsed" />
                    </Grid>

                    <Grid>
                        <HyperlinkButton x:Name="hbComment" ToolTipService.ToolTip="評論" Style="{StaticResource MenuLinkStyle}" Click="hbComment_Click">
                            <Image Source="/SinaDesktop;component/Images/comment.png" Width="32" HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </HyperlinkButton>
                        <Button x:Name="btCommentCount" Style="{StaticResource CustomizeButtonStyle}" Width="16" Height="16" Foreground="White" Margin="40,10,0,0" FontSize="10" Visibility="Collapsed" />
                    </Grid>
                    

                    <HyperlinkButton x:Name="hbFavorite" ToolTipService.ToolTip="收藏" Style="{StaticResource MenuLinkStyle}" Click="hbFavorite_Click" >
                        <Image Source="/SinaDesktop;component/Images/favorite.png" Width="32" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </HyperlinkButton>

                    <Grid>
                        <HyperlinkButton x:Name="hbFans" ToolTipService.ToolTip="粉丝" Style="{StaticResource MenuLinkStyle}" Click="hbFans_Click" >
                            <Image Source="/SinaDesktop;component/Images/Fans.png" Width="32" HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </HyperlinkButton>
                        <Button x:Name="btFollowerCount" Style="{StaticResource CustomizeButtonStyle}" Width="16" Height="16" Foreground="White" Margin="40,10,0,0" FontSize="10" Visibility="Collapsed" />
                        <!--<TextBlock x:Name="tbFollowerCount" Text="11" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="40,10,0,0" FontFamily="Verdana" Foreground="#FF31B2F9" />-->
                    </Grid>
                    
                    <HyperlinkButton ToolTipService.ToolTip="私信" Style="{StaticResource MenuLinkStyle}">
                        <Image Source="/SinaDesktop;component/Images/message.png" Width="32" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </HyperlinkButton>

                </StackPanel>

                <StackPanel Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Center">
                    <HyperlinkButton x:Name="hbWriteBlog" Click="hbWriteBlog_Click" ToolTipService.ToolTip="撰写" Style="{StaticResource MenuLinkStyle}">
                        <Image Source="/SinaDesktop;component/Images/writeblog.png" Width="32" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </HyperlinkButton>
                            
                    <HyperlinkButton x:Name="hbRefresh" ToolTipService.ToolTip="刷新" Style="{StaticResource MenuLinkStyle}" Click="hbRefresh_Click">
                        <Image Source="/SinaDesktop;component/Images/refresh.png" Width="32" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </HyperlinkButton>

                    <HyperlinkButton x:Name="hbSearch" ToolTipService.ToolTip="查找" Style="{StaticResource MenuLinkStyle}" Click="hbSearch_Click">
                        <Image Source="/SinaDesktop;component/Images/search.png" Width="32" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </HyperlinkButton>

                </StackPanel>
            </Grid>

            <Border x:Name="BrandingBorder" toolkit:DockPanel.Dock="Top" Height="0">
                <StackPanel x:Name="BrandingStackPanel" Style="{StaticResource BrandingStackPanelStyle}" Orientation="Horizontal" toolkit:DockPanel.Dock="Top" Margin="3,2,0,2">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <TextBox x:Name="txtStatus" Width="400" Margin="2" Height="60" HorizontalAlignment="Left" 
                                 TextWrapping="Wrap" AllowDrop="True" VerticalScrollBarVisibility="Auto" VerticalContentAlignment="Top"/>
                        <TextBlock x:Name="tbTextCount" Grid.Column="1" FontSize="48" HorizontalAlignment="Right" VerticalAlignment="Center" 
                                   Text="{Binding Path=Text.Length, ElementName=txtStatus, Converter={StaticResource TextCountConverter}}" 
                                   Visibility="{Binding Path=Text.Length, ElementName=txtStatus, Converter={StaticResource TextCountVisibilityConverter}}"
                                   FontFamily="Arial" FontWeight="Bold" Margin="-160,0,20,0" Opacity=".05"/>
                    </Grid>

                    <StackPanel Orientation="Vertical" >
                        <Button x:Name="btSubmit" Margin="2" Click="btSubmit_Click" MouseEnter="btSubmit_MouseEnter" MouseLeave="btSubmit_MouseLeave" 
                            Height="40" Width="48" Opacity=".5">
                            <Image Source="/SinaDesktop;component/Images/Post.png" Height="28" Width="28"/>
                        </Button>
                        
                        <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom">
                            <HyperlinkButton x:Name="hbAddImage" Content="图片" FontSize="12" Click="hbAddImage_Click" IsTabStop="False">
                            </HyperlinkButton>

                            <HyperlinkButton x:Name="hbAddTopic" Content="话题" FontSize="12" Click="hbAddTopic_Click" IsTabStop="False">
                            </HyperlinkButton>
                        </StackPanel>

                    </StackPanel>

                    <!--<Button x:Name="btLoadImage" Content="图片" Margin="2" Click="btLoadImage_Click" Height="48" Width="48" Opacity=".5"/>-->
                    <Image x:Name="imgLoad" Height="50" Width="50" Visibility="Collapsed"/>                   
                </StackPanel>
            </Border>

            <Grid toolkit:DockPanel.Dock="Right">
                <ScrollViewer HorizontalContentAlignment="Left" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Left" Margin="0" Style="{StaticResource PageScrollViewerStyle}">
                    <controls:DragDockPanelHost x:Name="dragDockPanelHost" Margin="0,2,0,0"  MinimizedColumnWidth="360" MaxRows="1" MaxColumns="1" >

                        <controls:DragDockPanel x:Name="homePanel" Margin="2" Width="360" MinWidth="360" MaxWidth="360"  Header="最新" PanelClosed="homePanel_PanelClosed" PanelIndex="0" >
                            <Border x:Name="HomeContentBorder" Grid.Row="1" Grid.Column="1">
                                <StackPanel Orientation="Horizontal">
                                    <ScrollViewer HorizontalContentAlignment="Left" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled"  Margin="1,0,0,0" Style="{StaticResource PageScrollViewerStyle}">
                                        <Border BorderThickness="0" VerticalAlignment="Top" HorizontalAlignment="Left" BorderBrush="Transparent" >
                                            <Grid Width="350">
                                                <navigation:Frame x:Name="FriendTimelineFrame" Source="/FriendTimeline" Margin="0,0,0,0"  UriMapper="{StaticResource mapper}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
                                            </Grid>
                                        </Border>
                                    </ScrollViewer>
                                    <Rectangle Width="1" Fill="LightGray" Opacity=".8"  HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="1,0,1,0" />
                                </StackPanel>
                            </Border>
                        </controls:DragDockPanel>

                        <!--<Rectangle Width="1" Fill="Gray" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="1,0,1,0" >
                        </Rectangle>-->

                        <controls:DragDockPanel x:Name="commentPanel" Margin="2" Header="評論" Width="360" MinWidth="360" MaxWidth="360" PanelIndex="1" PanelClosed="homePanel_PanelClosed">
                            <Border x:Name="CommentContentBorder" Grid.Row="1" Grid.Column="1">
                                <StackPanel Orientation="Horizontal">
                                    <ScrollViewer HorizontalContentAlignment="Left" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled"  Margin="1,0,0,0" Style="{StaticResource PageScrollViewerStyle}">
                                        <Border BorderThickness="0" VerticalAlignment="Top" HorizontalAlignment="Left" BorderBrush="Transparent" >
                                            <Grid Width="350">
                                                <navigation:Frame x:Name="CommentFrame" Source="/UserComment" Margin="0,0,0,0"  UriMapper="{StaticResource mapper}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
                                            </Grid>
                                        </Border>
                                    </ScrollViewer>
                                    <Rectangle Width="1" Fill="LightGray" Opacity=".8"  HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="1,0,1,0" />
                                </StackPanel>
                            </Border>
                        </controls:DragDockPanel>

                        <controls:DragDockPanel x:Name="favoritePanel" Margin="2" Header="收藏" Width="360" MinWidth="360" MaxWidth="360" PanelIndex="2" PanelClosed="homePanel_PanelClosed">
                            <Border x:Name="FavoriteContentBorder" Grid.Row="1" Grid.Column="1">
                                <StackPanel Orientation="Horizontal">
                                    <ScrollViewer HorizontalContentAlignment="Left" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled"  Margin="1,0,0,0" Style="{StaticResource PageScrollViewerStyle}">
                                        <Border BorderThickness="0" VerticalAlignment="Top" HorizontalAlignment="Left" BorderBrush="Transparent" >

                                            <Grid Width="350" >
                                                <navigation:Frame x:Name="FavoriteFrame" Source="/UserFavorite" Margin="0,0,0,0"  UriMapper="{StaticResource mapper}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
                                            </Grid>
                                        </Border>
                                    </ScrollViewer>
                                    <Rectangle Width="1" Fill="LightGray" Opacity=".8"  HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="1,0,1,0" />
                                </StackPanel>

                            </Border>
                        </controls:DragDockPanel>

                        <controls:DragDockPanel x:Name="mentionPanel" Margin="2" Header="點名" Width="360" MinWidth="360" MaxWidth="360" PanelIndex="3" PanelClosed="homePanel_PanelClosed">
                            <Border x:Name="AtContentBorder" Grid.Row="1" Grid.Column="1">
                                <StackPanel Orientation="Horizontal">
                                    <ScrollViewer HorizontalContentAlignment="Left" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled"  Margin="1,0,0,0" Style="{StaticResource PageScrollViewerStyle}">
                                        <Border BorderThickness="0" VerticalAlignment="Top" HorizontalAlignment="Left" BorderBrush="Transparent" >

                                            <Grid Width="350">
                                                <navigation:Frame x:Name="MentionFrame" Source="/UserMention" Margin="0,0,0,0"  UriMapper="{StaticResource mapper}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
                                            </Grid>
                                        </Border>
                                    </ScrollViewer>
                                    <Rectangle Width="1" Fill="LightGray" Opacity=".8"  HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="1,0,1,0" />
                                </StackPanel>

                            </Border>
                        </controls:DragDockPanel>

                        <controls:DragDockPanel x:Name="userprofilePanel" Margin="2" Header="用戶" Width="360" MinWidth="360" MaxWidth="360" PanelIndex="4" PanelClosed="homePanel_PanelClosed">
                            <Border x:Name="UserProfileContentBorder" Grid.Row="1" Grid.Column="1">
                                <ScrollViewer HorizontalContentAlignment="Left" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled"  Margin="5,0,0,0" Style="{StaticResource PageScrollViewerStyle}">
                                    <Border BorderThickness="0" VerticalAlignment="Top" HorizontalAlignment="Left" BorderBrush="Transparent" >

                                        <Grid Width="350" >
                                            <navigation:Frame x:Name="UserProfileFrame" Margin="0,0,0,0" UriMapper="{StaticResource mapper}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
                                        </Grid>
                                    </Border>
                                </ScrollViewer>
                            </Border>
                        </controls:DragDockPanel>

                        <controls:DragDockPanel x:Name="followerPanel" Margin="2" Header="粉丝" Width="360" MinWidth="360" MaxWidth="360" PanelIndex="5" PanelClosed="homePanel_PanelClosed">
                            <Border x:Name="UserFollowerContentBorder" Grid.Row="1" Grid.Column="1">
                                <ScrollViewer HorizontalContentAlignment="Left" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled"  Margin="5,0,0,0" Style="{StaticResource PageScrollViewerStyle}">
                                    <Border BorderThickness="0" VerticalAlignment="Top" HorizontalAlignment="Left" BorderBrush="Transparent" >

                                        <Grid Width="350" >
                                            <navigation:Frame x:Name="UserFollowerFrame" Source="/UserFollower"  Margin="0,0,0,0" UriMapper="{StaticResource mapper}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
                                        </Grid>
                                    </Border>
                                </ScrollViewer>
                            </Border>
                        </controls:DragDockPanel>
                    </controls:DragDockPanelHost>
                </ScrollViewer>

            </Grid>
        </toolkit:DockPanel>
    </Grid>

</navigation:Page>
